package com.hbnu.iostream;


import java.io.IOException;
import java.io.PipedOutputStream;

public class Send implements Runnable{

    //管道输入流

    PipedOutputStream pipedOutputStream;
    public Send(){
        pipedOutputStream = new PipedOutputStream();
    }

    @Override
    public void run() {
        String str = "Hello moon";


        try {
            pipedOutputStream.write(str.getBytes());
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                pipedOutputStream.close();
            } catch (IOException e) {
                throw new RuntimeException(e);
            }
        }
    }

    public PipedOutputStream getpipedOutputStream() {
        return pipedOutputStream;
    }
}
